package com.shengde.jinwawaforleader.base;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Chason on 2016/9/8.
 */

public abstract class BaseV4Fragment extends Fragment implements View.OnClickListener{
    public View view;
    public Activity acticity;

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initData(savedInstanceState);
        listener();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        acticity = getActivity();
    }

    /**
     * setContentView;
     */
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        view = initView(inflater);
        return view;
    }

    @Override
    public void onClick(View v) {
        onWidgetClick(v);
    }

    /**
     * 初始化view
     */
    public abstract View initView(LayoutInflater inflater);

    /**
     * 初始化数据
     */
    public abstract void initData(Bundle savedInstanceState);

    /**
     * 监听
     */
    public abstract void listener();

    // 初始化控件点击事件
    public abstract void onWidgetClick(View view);
}
